home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Source ƒ / sky source ƒ / HELIO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-16  |  1.8 KB  |  85 lines

  1. #include "sky.h"
  2.  
  3. helio()
  4. {
  5. /*
  6.  *    uses lambda, beta, rad, motion
  7.  *    uses xms, yms, zms, xdot, ydot, zdot
  8.  *    uses mag, semi, psi, tobliq
  9.  *    sets alpha, delta
  10.  *    sets geolam, geobet, georad
  11.  */
  12.  
  13. /*
  14.  *    helio converts from ecliptic heliocentric coordinates
  15.  *    referred to the mean equinox of date
  16.  *    to equatorial geocentric coordinates referred to
  17.  *    the true equator and equinox
  18.  */
  19.  
  20.     double xmp, ymp, zmp;
  21.  
  22. /*
  23.  *    compute geocentric distance of object and
  24.  *    compute light-time correction (i.i. planetary aberration)
  25.  */
  26.  
  27.     xmp = rad*cos(beta)*cos(lambda);
  28.     ymp = rad*cos(beta)*sin(lambda);
  29.     zmp = rad*sin(beta);
  30.     georad = sqrt((xmp+xms)*(xmp+xms) +
  31.         (ymp+yms)*(ymp+yms) +
  32.         (zmp+zms)*(zmp+zms));
  33.     geolam = lambda - .0057756e0*georad*ldot;
  34.     geobet = beta - .0057756*georad*bdot;
  35.     georad = rad - .0057756*georad*rdot;
  36.  
  37.     xmp = georad*cos(geobet)*cos(geolam);
  38.     ymp = georad*cos(geobet)*sin(geolam);
  39.     zmp = georad*sin(geobet);
  40.  
  41. /*
  42.  *    compute annual parallax from the position of the sun
  43.  */
  44.  
  45.     xmp += xms;
  46.     ymp += yms;
  47.     zmp += zms;
  48.     georad = sqrt(xmp*xmp + ymp*ymp + zmp*zmp);
  49.  
  50. /*
  51.  *    compute annual (i.e. stellar) aberration
  52.  *    from the orbital velocity of the earth
  53.  *    (by an incorrect method)
  54.  */
  55.  
  56.     xmp -= xdot*georad;
  57.     ymp -= ydot*georad;
  58.     zmp -= zdot*georad;
  59.  
  60. /*
  61.  *    perform the nutation and so convert from the mean
  62.  *    equator and equinox to the true
  63.  */
  64.  
  65.     geolam = atan2(ymp, xmp);
  66.     geobet = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  67.     geolam += psi;
  68.  
  69. /*
  70.  *    change to equatorial coordinates
  71.  */
  72.  
  73.     xmp = georad*cos(geolam)*cos(geobet);
  74.     ymp = georad*(sin(geolam)*cos(geobet)*cos(tobliq) - sin(tobliq)*sin(geobet));
  75.     zmp = georad*(sin(geolam)*cos(geobet)*sin(tobliq) + cos(tobliq)*sin(geobet));
  76.  
  77.     alpha = atan2(ymp, xmp);
  78.     delta = atan2(zmp, sqrt(xmp*xmp+ymp*ymp));
  79.  
  80.     hp = 8.794e0*radsec/georad;
  81.     semi /= georad;
  82.     if(rad > 0. && rad < 2.e5)
  83.         mag += 2.17*log(rad*georad);
  84. }
  85.